<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>堆叠折现图</title>
    <script src="../../echarts.min.js"></script>
</head>
<body>
    <div id="main" style="width: 600px;height: 400px;"></div>
</body>
<script>
    let mychart = echarts.init(document.getElementById("main"))
    option={
        title:{
            text:"堆叠图",
            left:"center"
        },
        legend:{
            left:"right",
            data:["A产品销量","B产品销量","C产品销量"],
            orient:"vertical"
        },
        tooltip:{
            trigger:"axis",
            axisPointer:{
                type:"cross",
                /*label:{
                    backgroundColor:"#6a7985"
                }*/
            }
        },
        xAxis:{
            name:"日期",
            type:"category",
            data:["Mon","Tue","Wed","Thr","Fri",'Sat',"Sun"]
        },
        grid:{
            top:"18%"
        },
        yAxis:{type:"value"},
        series:[
            {
                name:"A产品销量",
                type:"line",
                data:[550,232,311,764,1090,830,500],
                smooth:true,
                stack:"总量",
                areaStyle:{}
            },
            {
                name:"B产品销量",
                type:"line",
                data:[420,162,212,564,1360,430,580],
                smooth:true,
                stack:"总量",
                areaStyle:{}
            },
            {
                name:"C产品销量",
                data:[420,122,112,464,160,130,280],
                type:"line",
                smooth:true,
                stack:"总量",
                areaStyle:{},
            }
        ]
    }
    mychart.setOption(option)
</script>
</html>